﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Zombie : MonoBehaviour
{
    public StateMachine<Zombie> stateMachine;
    public Transform eye;

    public float viewRadius;
    public float viewAngle;
    public float viewAngeleStep;

    public float moveSpeed;

    public Transform target;

    void Start()
    {
        stateMachine = new StateMachine<Zombie>(this);
        stateMachine.AddState(new ZombieState_Wait("Wait"));
        stateMachine.AddState(new ZombieState_Track("Track"));
        stateMachine.AddState(new ZombieState_Attack("Attack"));
        stateMachine.ChangeState("Wait");
    }


    void Update()
    {
        stateMachine.Update();
    }

    public void ChageState(string stateName)
    {
        if (!stateMachine.IsState(stateName))
        {
            stateMachine.ChangeState(stateName);
        }
    }
}
